/* eslint-disable no-unused-vars */
import React, { useState } from "react";
import { HashRouter as Router, Route, Switch } from "react-router-dom";
import Parta from "../components/order/Parta";
import Partb from "../components/order/Partb";
import Product from "../components/order/product";

export default function Index(prop) {
    const [menuRouter, setMenuRouter] = useState([
        {
            id: 1,
            path: "/menu/order",
            name: "/order/parta",
            component: Parta,
            exact: true
        },
        {
            id: 2,
            path: "/menu/order/parta",
            name: "/order/parta",
            component: Parta,
        },
        {
            id: 3,
            path: "/menu/order/partb",
            name: "/order/partb",
            component: Partb,
        },
        {
            id: 3,
            path: "/menu/order/product",
            name: "/order/partb",
            component: Product,
            exact: true
        },
        {
            id: 3,
            path: "/menu/order/product/:orderid",
            name: "/order/partb",
            component: Product,
        },


    ])
    return (
        <Router>
            <Switch>
                {menuRouter.map((item) => {
                    return (
                        <Route
                            key={item.id}
                            path={item.path}
                            component={item.component}
                            exact={item.exact}
                            prop={prop}
                        ></Route>
                    );
                })}
            </Switch>
        </Router>
    )
}